using UnityEngine;
using System.Collections;



public enum WorldName
{
	WORLD_NONE = -1
	
,	WORLD_1

,	WORLD_COUNT
}

public enum LevelName
{
	LEVEL_NONE = -1
	
,	MINIGAME_BURNCALORIESBURN
,	MINIGAME_FEETCHACHA
,	MINIGAME_ROLLINGFEAR
,	MINIGAME_SPITFIRE
,	MINIGAME_HEADOMATIC
	
,	LEVEL_COUNT
}

public enum LevelType
{
	TYPE_NONE = -1
	
,	TYPE_BASIC = 0
,	TYPE_INVISIBLE
	
}

public enum TourName
{
	TOUR_NONE = -1
	
,	TOUR_TOUR1
,	TOUR_TOUR2
,   TOUR_TOUR3
,   TOUR_TOUR4
,   TOUR_TOUR5
,   TOUR_TOUR6
,   TOUR_TOUR7
,   TOUR_TOUR8
,   TOUR_TOUR9
,   TOUR_COUNT
}

public class WorldStaticData
{
	public WorldName		WorldName;
	public int				StarsToUnlock;
	
	public WorldStaticData(WorldName eWorldName, int iStarsToUnlock)
	{
		WorldName = eWorldName;
		StarsToUnlock = iStarsToUnlock;
	}
}

public class LevelStaticData
{
	public LevelName		LevelName;
	public int				StarsToUnlock;
	public LevelType		LevelType;
	
	public LevelStaticData(LevelName eLevelName, int iStarsToUnlock, LevelType eLevelType)
	{
		LevelName = eLevelName;
		StarsToUnlock = iStarsToUnlock;
		LevelType = eLevelType;
	}
	
	public string LevelNameString
	{
		get { return LevelName.ToString().ToLower(); }
	}
	
}

public class TourStaticData
{
	public TourName		TourName;
	public LevelName[]	LevelNames;
	
	public TourStaticData(TourName name, LevelName[] levelNames)
	{
		TourName = name;
		LevelNames = levelNames;
	}
}

public static class SV_WorldsLevelsData
{
	public static WorldStaticData[] m_WorldsData = new WorldStaticData[]
	{
		new WorldStaticData(WorldName.WORLD_1, 0)
	};
		
	public static LevelStaticData[][] m_LevelsData = new LevelStaticData[(int)WorldName.WORLD_COUNT][]
	{
			// WORLD 0
		new LevelStaticData[]
		{
			new LevelStaticData(LevelName.MINIGAME_BURNCALORIESBURN,	0,	LevelType.TYPE_BASIC)
		,	new LevelStaticData(LevelName.MINIGAME_FEETCHACHA,			0,	LevelType.TYPE_BASIC)
		,	new LevelStaticData(LevelName.MINIGAME_ROLLINGFEAR,			0,	LevelType.TYPE_BASIC)
		,	new LevelStaticData(LevelName.MINIGAME_SPITFIRE,			0,	LevelType.TYPE_BASIC)
		,	new LevelStaticData(LevelName.MINIGAME_HEADOMATIC,			0,	LevelType.TYPE_BASIC)
		}
	};
	
	public static TourStaticData[] m_ToursData = new TourStaticData[]
	{
/*
	,	{ TourName.TOUR_TOUR1,				"A Quick Tour" }
	,	{ TourName.TOUR_TOUR2,				"5 Games" }
	,	{ TourName.TOUR_TOUR3,				"Single Event: CaloRace" }
	,	{ TourName.TOUR_TOUR5,				"Single Event: Broil Hop" }
	,	{ TourName.TOUR_TOUR4,				"Single Event: Tempo Run" }
	,	{ TourName.TOUR_TOUR6,				"Single Event: Log Jump" }
	,	{ TourName.TOUR_TOUR7,				"Single Event: Head Counter" }
 
 	,	{ LevelName.MINIGAME_BURNCALORIESBURN,		"Calorace"					}
	,	{ LevelName.MINIGAME_FEETCHACHA,			"Tempo Run"				}
	,	{ LevelName.MINIGAME_HEADOMATIC,			"Head Counter"				}
	,	{ LevelName.MINIGAME_ROLLINGFEAR,			"Log Jump"				}
	,	{ LevelName.MINIGAME_SPITFIRE,				"Broil Hop"					}

 */
		new TourStaticData(TourName.TOUR_TOUR1, new LevelName[] { LevelName.MINIGAME_SPITFIRE, LevelName.MINIGAME_BURNCALORIESBURN, LevelName.MINIGAME_ROLLINGFEAR, LevelName.MINIGAME_FEETCHACHA, LevelName.MINIGAME_HEADOMATIC })
	,	new TourStaticData(TourName.TOUR_TOUR2, new LevelName[] { LevelName.MINIGAME_ROLLINGFEAR, LevelName.MINIGAME_BURNCALORIESBURN, LevelName.MINIGAME_HEADOMATIC})
	,	new TourStaticData(TourName.TOUR_TOUR3, new LevelName[] { LevelName.MINIGAME_BURNCALORIESBURN, LevelName.MINIGAME_FEETCHACHA })
	,	new TourStaticData(TourName.TOUR_TOUR4, new LevelName[] { LevelName.MINIGAME_SPITFIRE, LevelName.MINIGAME_ROLLINGFEAR })
	,	new TourStaticData(TourName.TOUR_TOUR5, new LevelName[] { LevelName.MINIGAME_BURNCALORIESBURN })
	,	new TourStaticData(TourName.TOUR_TOUR6, new LevelName[] { LevelName.MINIGAME_SPITFIRE })
	,	new TourStaticData(TourName.TOUR_TOUR7, new LevelName[] { LevelName.MINIGAME_FEETCHACHA })
	,	new TourStaticData(TourName.TOUR_TOUR8, new LevelName[] { LevelName.MINIGAME_ROLLINGFEAR })
	,	new TourStaticData(TourName.TOUR_TOUR9, new LevelName[] { LevelName.MINIGAME_HEADOMATIC })
	};
	
	public static LevelName GetLevelNameFromTour(TourName eTour, int iMGIdx)
	{
		LevelName eRetVal = LevelName.LEVEL_NONE;
		
		for(int iTour = 0; iTour < m_ToursData.Length; iTour++)
		{
			if(m_ToursData[iTour].TourName == eTour)
			{
				if(iMGIdx >= 0 && iMGIdx < m_ToursData[iTour].LevelNames.Length)
					eRetVal = m_ToursData[iTour].LevelNames[iMGIdx];
				
				break;
			}
		}
		
		return eRetVal;
	}
	
	public static bool GetWorldAndLevel(LevelName eLevelName, out int iWorld, out int iLevel)
	{
		bool bRVal = false;
		iWorld = 0;
		iLevel = 0;
		
		for(int iWorldIdx = 0; (iWorldIdx < m_LevelsData.GetLength(0)) && !bRVal; ++iWorldIdx)
		{
			for(int iLevelIdx = 0; (iLevelIdx < m_LevelsData[iWorldIdx].Length) && !bRVal; ++iLevelIdx)	
			{
				if(m_LevelsData[iWorldIdx][iLevelIdx].LevelName == eLevelName)
				{
					bRVal = true;
					iWorld = iWorldIdx;
					iLevel = iLevelIdx;
				}
			}
		}
		
		return bRVal;
	}
}